
abstract class Animals{
  private String name;
  private int age;
  public Animals(){}
  public Animals (String name,int age){
      this.name = name;
      this.age = age;
  }

    public void setAge(int age) {
        this.age = age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }
    public abstract void eat();

}
class Dogs extends Animals{
    public Dogs(){}
    public Dogs(String name,int age)
    {super(name,age);}
    public void eat(){
        System.out.println("狗吃肉");
    }

}
public class AbstractDemo {
    public static void main(String[] args) {
        Animals a = new Dogs();
        a.setAge(2);
        a.setName("wangwang");


    }
}

